Baking textures to GLB changes UV mapping of objects. And what value to set for dpi when exporting to GLB?

Hello everyone,

Lately I have been working a lot on making GLB format models for real time viewing in Google Model Viewer. Recently I tried baking a model with textures and labels from Keyshot into a GLB format for online viewing. All parts of my model have UVs, but when I export my model from Keyshot it changes the whole UV layout of every part of my model. This gives very sloppy textures as a result. And it also drastically changes the UV spacing. Creating issues for certain models in which I gave parts of the model more UV space for more texture resolution (as is the case in the example part below).

Keyshot then also generates textures that are not 1:1 in aspect ratio. In the example below, Keyshot generates textures with a 1669x1512 pixel resolution.

And besides that, how can you properly control the texture resolution outcome, when you can control it only with a dpi value? Why is this not a texture resolution value (I know that this is probably more of a question for the developers)?

Does anyone have experience with my issues stated above? How to properly get all textures and labels baked without the UV mapping of objects being changed. And controlling a proper outcome of texture resolution and aspect ratio?

— Below is an example of a part of one of my models —

This is the UV map of the part:

This is the part as it looks in Keyshot:

These are the baked texture results from Keyshot (all with a 1669x1512 pixel resolution):

Hope anyone has some good insights. Thank you.

I did a feature request some time ago about the dpi input. It makes really no sense having to put in dpi values if you’re working with 3D models. DPI only matters in print. That you can convert one to another since the 3D object has a certain scale doesn’t mean a user should have to calculate those in my opinion.

It would be much better if it was based on pixels and just had a pulldown with 1024/2048/4096/8192, pixels that is. There’s some other pull-down somewhere which has weird values like 1000/2000/4000 which are also not values that are common if it’s about textures.

Anyway, that’s about usability. But if you want to know how much pixels you need… you can do something like this.

Create an image the size of your object, I picked 100x80mm for now. Just create that image and than select ‘resize image’ in Photoshop. If you now change the DPI you see the pixel size so you know how high you need to push the DPI to get for example a texture from 4096 x something pixels.

Not very friendly but this gives you a direction. I think this weird logic is also the reason why it doesn’t give you square images based on your actual UVs.

I’m not sure what the reasoning is behind creating new UVs and I actually never noticed it did but have to test it again. Maybe it does when you have labels added since they are not placed using an UV most of the time so that might trigger it to fix a new UV.

Hi Oscar, Thank you for the reply. I was worried that it would end up with a work around like what you are showing. Thank you for the demo.
I also don’t understand the benefit of dpi instead of something like the more general textures resolutions (1024/2048/4096/8192 pixels). Guess they haven’t come around to implementing it yet.

I also just tried exporting with no label attached to the material, and it gives the same result with the same changed UV layout. Please let me know what you find if you ever decide to retest it as well.

Just tried it with a model I was repainting for MSFS for fun.

But seems to keep the UVs if I select this box as well. But this model doesn’t have any labels and I’m not sure how it handles those. I can try if you have the same even with checking this box.

BTW, the DPI setting I used for this one was ‘5 dpi’ which is the setting it had at the start. 5 DPI does exactly say nothing about how big my files will be which is I think important if you want to create GLB models which are often used online, this as a sidenote for people from Luxion reading this thread :slight_smile:

Hey I just checked. I was using an older version of Keyshot that did not have this option. So I guess that solves that issue. Thank you Oscar.

1 Like

Nice, I used 2023 but also have 11.3.3 installed and that has it as well, might be introduced in the later 11 versions. Hope it works out with the UVs, it’s just a bit of trial and error for the DPI. If you have it very high it might take a loooong time :slight_smile:

Yes it seems to be there from Keyshot 11 onwards.
And I have noticed with the dpi, that setting the wrong value indeed takes a loooong time :sweat_smile:

Thanks again for the help.

I think the baking currently uses CPU and hope that will switch to GPU in the future since it would be a lot faster baking textures.